Skip to content

Conversation

Divyanshu7001
Copy link

1. Goal

This PR adds support for tracing Effect computations in the Sentry Node SDK. The goal is to automatically create Sentry spans for Effect operations and capture errors that occur within Effect computations as Sentry exceptions, providing better observability for users of the Effect library.

2. Pathway Taken

  • Added a new integration (effectIntegration) and instrumentation (instrumentEffect) under @sentry/node.
  • Followed the robust test/mocking patterns from other integrations to ensure isolated, reliable tests.
  • Updated the SDK’s auto-integration and preload logic to include Effect.
  • Added the effect package as a dependency and provided type definitions for Effect’s tracer API.
  • Wrote comprehensive unit tests for the integration, covering all tracer hooks and error scenarios.

3. How the integration has happened and where it is included now

  • The integration is implemented in packages/node/src/integrations/tracing/effect/.
  • It is exported from the main SDK entrypoint and included in the auto-performance integrations list.
  • The SDK will now automatically register the Effect tracer if the Effect library is present in the user’s project.

4. How users should integrate Effect into their own project

Basic usage:

const Sentry = require('@sentry/node');

Sentry.init({
  dsn: 'YOUR_DSN',
  integrations: [
    Sentry.effectIntegration(),
    // ...other integrations
  ],
  // ...other options
});
  • Just add Sentry.effectIntegration() to your integrations array.
  • The SDK will automatically patch Effect’s tracer and start capturing spans and errors.
  • No manual instrumentation is required for most use cases.

5. Where am i stuck / need help

  • Some test cases are still flaky or failing due to mocking or module loading order (see attached images).
Screenshot 2025-08-19 054036 Screenshot 2025-08-19 054110 Screenshot 2025-08-19 054126 Screenshot 2025-08-19 054055

6. What is my thinking about these errors?

I think these errors are due to me not being able to setup the test environment properly as in most errors..the problem is just Span processes being undefined.
I would appreciate some pointers of where i am going wrong and how should i setup the test environment properly to test.

@Divyanshu7001 Divyanshu7001 requested a review from a team as a code owner August 19, 2025 00:17
@marbemac
Copy link

marbemac commented Sep 8, 2025

Just a quick note - @Divyanshu7001 the auto formatting on your machine resulted in lots of unrelated files being changed that make it more difficult to digest this PR.

@Divyanshu7001
Copy link
Author

Just a quick note - @Divyanshu7001 the auto formatting on your machine resulted in lots of unrelated files being changed that make it more difficult to digest this PR.

I was afraid of the same thing & thats why used github codespaces with no local settings
but yes..i did run yarn fix to do all the linting fixes on the package level , which has caused this issue.😅
@marbemac would you prefer another PR without the linting fixes?
i can do that if that will suit things better.

all open for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants